<?php defined('InShopNC') or exit('Access Invalid!');?>

<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <div class="subject">
        <h3>首页商品显示</h3>
        <h5>商城首页预售商品促销活动设置与管理</h5>
      </div>
      <?php echo $output['top_link'];?>
    </div>
  </div>
  <!-- 操作说明 -->
  <div class="explanation" id="explanation">
    <div class="title" id="checkZoom"><i class="fa fa-lightbulb-o"></i>
      <h4 title="<?php echo $lang['nc_prompts_title'];?>"><?php echo $lang['nc_prompts'];?></h4>
      <span id="explanationZoom" title="<?php echo $lang['nc_prompts_span'];?>"></span>
    </div>
    <ul>
      <li>商家发布的预售商品列表。</li>
    </ul>
  </div>
  <div id="flexigrid"></div>
</div>


<script>
    $(function(){
        $("#flexigrid").flexigrid({
            url: 'index.php?act=promotion_book&op=get_presell_gold_xml',
            colModel: [
                {display: '操作', name: 'operation', width: 180, sortable: false, align: 'center', className: ''},
                {display: '商品SKU', name: 'goods_id', width: 60, sortable: true, align: 'left'},
                {display: '商品名称', name: 'goods_name', width: 400, sortable: true, align: 'left'},
                {display: '开始时间', name: 'start_time', width: 80, sortable: true, align: 'center'},
                {display: '结束时间', name: 'end_time', width: 80, sortable: true, align: 'center'},
                {display: '展示图片', name: 'intro_image', width: 80, sortable: true, align: 'center'},
                {display: '发货时间', name: 'presell_deliverdate', width: 80, sortable: true, align: 'center'},
                {display: '商品价格', name: 'goods_price', width: 80, sortable: true, align: 'center'},
                {display: '店铺ID', name: 'store_id', width: 60, sortable: true, align: 'left'},
                {display: '店铺名称', name: 'store_name', width: 100, sortable: true, align: 'left'}
            ],
            searchitems: [
                {display: '商品名称', name: 'goods_name', isdefault: true}
            ],
            sortname: "goods_id",
            sortorder: "desc",
            title: '黄金专题预售商品列表'
        });
    });

function fg_del(id,store_id) {
    if(confirm('删除后将不能恢复，确认删除这项吗？')){
        $.getJSON('index.php?act=promotion_book&op=del_home_goods', {id:id,store_id:store_id}, function(data){
            if (data.result) {
                $("#flexigrid").flexReload();
            } else {
                showError(data.msg)
            }
        });
    }
}

    $('a[data-href]').live('click', function() {
        if ($(this).hasClass('confirm-on-click') && !confirm('确定"'+$(this).text()+'"?')) {
            return false;
        }

        $.getJSON($(this).attr('data-href'), function(d) {
            if (d && d.result) {
                $("#flexigrid").flexReload();
            } else {
                alert(d && d.message || '操作失败！');
            }
        });
    });
</script>
